1. Field of the Invention
The invention relates generally to field of texture compression and decompression in computer graphics.
2. Background
A texture is a one-, two- or multi-dimensional array of data items used in the calculation of the color or appearance of fragments produced by rasterization of a computer graphics scene. A texture could be image data (either photographic or computer generated), color or transparency data, roughness/smoothness data, reflectivity data, etc. Providing realistic computer graphics typically requires many high quality, detailed textures. Providing such textures can tax available computer memory and bandwidth. Texture compression can therefore significantly reduce memory and bandwidth requirements.
Texture compression has thus become a widely accepted feature of graphics hardware in general and 3D graphics hardware in particular. Indeed, forms of texture compression date back to the earliest pieces of graphics hardware. The goal of texture compression is to reduce storage and bandwidth costs on the graphics system while retaining as much of the quality of the original texture as possible. Attaining this goal, however, has proved to be complex and has generated several different approaches, some of which are described briefly below.
Palletization is amongst the oldest forms of texture compression. Its roots date back to the earliest days of color computer graphics. Typically, palletized formats are represented by 8 bits of data per pixel, permitting a maximum of 256 colors chosen from the complete colorspace (usually quantized to 16 or 32 bits). Some images can be well represented by this approach, but it is not uncommon for the palletizing process to generate significant visual artifacts. Palletization is clearly limited when dealing with real-world images such as photographs, where the limited set of available colors is quickly exhausted. Image space techniques such as dithering are used for improving the quality of palletized images, but are difficult to use with textures because if the texture is magnified, the desired effect of the dithering may be lost, and the dithering itself may introduce undesirable artifacts. Palletized methods have some additional attributes that can make them less attractive for implementation in graphics hardware—for instance, they introduce an indirection when looking up color values. Palletization might also require storage for multiple palettes simultaneously for multi-texturing support. Generally, the quality achieved per-bit is quite low with palletization, and it has largely been superseded by more advanced methods.
Vector Quantization (“VQ”), developed by PowerVR, is another specific texture compression technique. It works by storing a limited “codebook” of representative entries to define a texture. The codebook entries are blocks of pixels of some size (typically 2×2 or larger). For each block of pixels in the original texture, an index is stored to the codebook entry that most closely approximates the block. VQ can achieve very high compression rates (down to about 2 bits per pixel) while still retaining fair quality. Nonetheless, it shares some of the undesirable qualities of palettisation with respect to texture compression. For instance, the type of artifacts introduced by VQ compression can be quite noticeable on texture images, and it frequently shows visible artifacts on some common texture contents such as smooth gradients.
The Joint Photographic Experts Group (JPEG) algorithms are another image compression technique. JPEG achieves a very high quality of compression at a low bit rate, but the compression is of a variable rate. Variable rate compression makes addressing the texture map very difficult compared to fixed-rate schemes. As a result, there has been no adoption of JPEG compression in consumer 3D graphics systems except for the limited purpose of reducing a system memory imprint. For example, JPEG compression is used on Sony's Playstation 2 to reduce the system memory footprint, but the system does not texture directly from the compressed JPEG representation.
DXTC (sometimes referred to as DXTn) is a block-based texture compression scheme has been adopted by all major hardware vendors and is the most widely used today. An extension of Block Truncation Coding (BTC), it explicitly stores two 16-bit colors per 4×4 pixel block and two other colors that are implicitly represented as being interpolants between these endpoints, with an index of 2 bits per pixel to choose the colors for the pixel block. As a result it achieves overall color compression to 4 bits per pixel. DXTC represents the original texture data quite well in the majority of cases. However, DXTC has problems with textures having many different color hues within each block. Additionally, the low precision of the endpoints and small number of interpolants can produce some noise on gradients, particularly ones that are oriented diagonally to the pixel blocks. DXTC also has problems with textures containing blocks that have multiple separate color gradients at different orientations, as accurate compression of one gradient must typically be sacrificed when mapping the points to a line through the colorspace. This happens frequently in images such as normal maps. A DXTC extension allows 4 component images (with alpha) to be represented at 8 bits per pixel.
FXT 1 is a competing compression scheme with DXTC. It essentially extends DXTC with some additional block types that can be mixed within any given image, and also provides a 4 bits per pixel compression mode for textures with alpha. The gains in image quality over DXTC were never conclusive and FXT 1 received limited industry support.
PVR-TC is a recently developed compression scheme that scales an image down to a fraction of its original size and then scales it back up to obtain a good first-approximation of the original image. Texture compression is thus achieved by storing the downscaled version and then adding some modulation to create a fairly accurate reconstruction of the original data. This texture compression scheme works well for some types of data (particularly smooth gradients), and scales reasonably even to low bit rates. However, PVR-TC has a tendency to blur images somewhat and lose high frequency details. Occasionally the PVR-TC compression also seems to introduce other artifacts such as high frequency modulation noise and ringing.
A review of current texture compression techniques and their limitations reveals a need for improvements. An ideal solution would allow compression of various types of data and would have the flexibility to make the best use of available memory and bandwidth. Additionally, traditional texture compression schemes target a specific type of texture content (e.g., JPEG for photographic images) and perform well within that set, but perform poorly as soon as presented with a type of image outside of the designated set. Another challenge is thus to broaden the scope of texture compression to adequately cover a wider base of image types.
The present invention will now be described with reference to the accompanying drawings. In the drawings, like reference numbers indicate identical or functionally similar elements. Additionally, the left-most digit(s) of a reference number identifies the drawing in which the reference number first appears.